Add test fresh_builds_possible_with_link_libs
authorNathanael Jones <nathanael.jones@gmail.com>
Wed, 8 Feb 2017 02:05:10 +0000 (19:05 -0700)
committerNathanael Jones <nathanael.jones@gmail.com>
Wed, 8 Feb 2017 02:05:10 +0000 (19:05 -0700)
tests/build-script.rs

index d0179e68a203ee59e29be9f1e950d55b7c6bb495..5f4dee7648f74f55ad70b0a91138df31bc13da56 100644 (file)
@@ -1781,6 +1781,46 @@ fn changing_an_override_invalidates() {
 "));
 }
 
+
+#[test]
+fn fresh_builds_possible_with_link_libs() {
+    // The bug is non-deterministic. Sometimes you can get a fresh build
+    let target = rustc_host();
+    let p = project("foo")
+        .file("Cargo.toml", r#"
+            [project]
+            name = "foo"
+            version = "0.5.0"
+            authors = []
+            links = "nativefoo"
+            build = "build.rs"
+        "#)
+        .file("src/lib.rs", "")
+        .file(".cargo/config", &format!("
+            [target.{}.nativefoo]
+            rustc-link-lib = [\"a\"]
+            rustc-link-search = [\"./b\"]
+            rustc-flags = \"-l z -L ./\"
+        ", target))
+        .file("build.rs", "");
+    assert_that(p.cargo_process("build").arg("-v"),
+                execs().with_status(0).with_stderr("\
+[COMPILING] foo v0.5.0 ([..]
+[RUNNING] `rustc [..]`
+[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
+"));
+
+    assert_that(p.cargo("build")
+                 .arg("-v")
+                 .env("RUST_LOG", "cargo::ops::cargo_rustc::fingerprint=info"),
+                execs().with_status(0).with_stderr("\
+[FRESH] foo v0.5.0 ([..])
+[FINISHED] dev [unoptimized + debuginfo] target(s) in [..]
+"));
+}
+
+
 #[test]
 fn fresh_builds_possible_with_multiple_metadata_overrides() {
     // The bug is non-deterministic. Sometimes you can get a fresh build